<template>
	<view>
		<view class="header">
			<view class="title">数据列表</view>
			<view class="bottonGroup">
			  <view class="botton focus">全部</view>
			</view>
		</view>
	
		<view style="width: 100%; position: absolute;">
			<view style="position: absolute; top: -40rpx; left: 50%; width: 95%; transform: translate(-50%, -3%);">
				<scroll-view scroll-y="true" @scrolltolower="lower" :style="{height: scrollViewHeight+'px'}" style="position: initial; bottom: 0; left: 0; right: 0; top: 0;" lower-threshold="200">
					<view style="width: 100%; float: left; border-radius: 30rpx; background-color: #fff; margin-top: 20rpx" v-for="item in dataList">
						<view style="padding: 0rpx 25rpx">
							<view style="width: 100%; float: left; padding: 10px 0px;">
							<view>
								<view style="display: flex; padding: 5rpx;">
								    <view style="font-size: 30rpx; color: #777777; width: 25%;">
								        活动 ID
								    </view>
								    <view style="font-size: 30rpx; width: 75%; color: #F25454;">
								        {{item.id}}
								    </view>
								</view>
								<view style="display: flex; padding: 5rpx">
								    <view style="font-size: 30rpx; color: #777777; width: 25%;">
								        活动名称
								    </view>
								    <view style="font-size: 30rpx; width: 75%;">
								        {{item.activity_title}}
								    </view>
								</view>
								<view style="display: flex; padding: 5rpx">
								    <view style="font-size: 30rpx; color: #777777; width: 25%;">
								        商家名称
								    </view>
								    <view style="font-size: 30rpx; width: 75%;">
								        {{item.nickname}}
								    </view>
								</view>
								<view style="display: flex; padding: 5rpx">
								    <view style="font-size: 30rpx; color: #777777; width: 25%;">
								        总订单
								    </view>
								    <view style="font-size: 30rpx; width: 75%;">
								        {{item.order_count}}
								    </view>
								</view>
								<view style="display: flex; padding: 5rpx">
								    <view style="font-size: 30rpx; color: #777777; width: 25%;">
								        总金额
								    </view>
								    <view style="font-size: 30rpx; width: 75%; color: #F25454;">
								        ￥{{item.order_total_price}}
								    </view>
								</view>
							</view>
						</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import * as api from '@/api/channel'
	import storage from '@/utils/storage'
	export default {
		components: {
		},
		data() {
			return {
				scrollViewHeight: '',
				dataList: [],
				page: 1,
				limit: 10
			}
		},
		onReady() {
			// 计算 scrollview 高度
			this.scrollViewHeight = uni.getSystemInfoSync().windowHeight - 40 - uni.getMenuButtonBoundingClientRect().top
		},
		// onHide() {
		// 	this.page = 1;
		// 	this.dataList = [];
		// },
		onLoad() {
			this.getInfo();
		},
		methods: {
			lower: function(e) {
				this.page = this.page + 1;
				this.getInfo();
			},
			getInfo: function () {
				api.activityList({
					channel_id: storage.get('channelId'),
					page: this.page,
					limit: this.limit
				}).then(res => {
					this.dataList = this.dataList.concat(res.data);
				})
			}
		},
		mounted() {
			
		}
	}
</script>

<style>
	page {
	    background-color: #F6F7FB;
	}
	.header {
		background-color: #F35847;
		position: inherit;
		width: 100%;
		height: 250rpx;
		border-radius: 0rpx 0rpx 20rpx 20rpx;
	}
	.header > .title {
		color: #fff;
		padding: 30rpx;
		font-size: 40rpx;
		font-weight: bold;
	}
	.header > .bottonGroup {
	  width: 100%;
	  position: initial;
	  display: inline-table;
	  text-align: center;
	  margin-top: 0px;
	}
	.header > .bottonGroup view {
	  font-size: 28rpx;
	  float:left;
	  padding: 5px 10px;
	  margin-right: 5px;
	  margin: 0px 0px 10px 10px;
	  z-index: 999;
	}
	.header > .bottonGroup .botton {
	  color: #FFFFFF;
	}
	.header > .bottonGroup .focus {
		border-bottom: 3px solid #FFFFFF;
		color: #FFFFFF;
	}
</style>